home *** CD-ROM | disk | FTP | other *** search
- import java.awt.Button;
- import java.awt.Component;
- import java.awt.Container;
- import java.awt.Event;
- import java.awt.FileDialog;
- import java.awt.Frame;
- import java.awt.LayoutManager;
- import java.awt.List;
- import java.awt.Menu;
- import java.awt.MenuBar;
- import java.awt.MenuItem;
- import java.util.Enumeration;
- import java.util.Vector;
-
- public class Frame1 extends Frame {
- // $FF: renamed from: v java.util.Vector
- Vector field_0;
- FileDialog OpenFileDialog;
- List list1;
- Button button1;
- MenuBar mainMenuBar;
- Menu menu1;
- Menu menu2;
- Menu menu3;
-
- void button1_Clicked(Event event) {
- this.list1.clear();
-
- for(Enumeration e = this.field_0.elements(); e.hasMoreElements(); this.list1.addItem("--------------------")) {
- Thing t = (Thing)e.nextElement();
- this.list1.addItem(t.getName());
- this.list1.addItem(t.getDescription());
- if (t instanceof Object) {
- this.list1.addItem("[This is an Object]");
- }
-
- if (t instanceof Thing) {
- this.list1.addItem("[This is a Thing]");
- }
-
- if (t instanceof Creature) {
- this.list1.addItem("[This is a Creature] species = " + ((Creature)t).getSpecies());
- }
-
- if (t instanceof Treasure) {
- this.list1.addItem("[This is a Treasure] value = " + ((Treasure)t).getValue());
- }
- }
-
- }
-
- void Open_Action(Event event) {
- this.OpenFileDialog.show();
- }
-
- void About_Action(Event event) {
- (new AboutDialog(this, "About...", false)).show();
- }
-
- void Exit_Action(Event event) {
- (new QuitDialog(this, "Quit the Application?", false)).show();
- }
-
- public Frame1() {
- this.field_0 = new Vector();
- ((Container)this).setLayout((LayoutManager)null);
- ((Frame)this).addNotify();
- ((Component)this).resize(((Container)this).insets().left + ((Container)this).insets().right + 431, ((Container)this).insets().top + ((Container)this).insets().bottom + 464);
- this.OpenFileDialog = new FileDialog(this, "Open", 0);
- this.list1 = new List(0, false);
- ((Container)this).add(this.list1);
- this.list1.reshape(((Container)this).insets().left + 7, ((Container)this).insets().top + 8, 416, 345);
- this.button1 = new Button("Display My Objects!");
- this.button1.reshape(((Container)this).insets().left + 133, ((Container)this).insets().top + 383, 159, 39);
- ((Container)this).add(this.button1);
- ((Frame)this).setTitle("A Basic Application");
- this.mainMenuBar = new MenuBar();
- this.menu1 = new Menu("File");
- this.menu1.add("Open...");
- this.menu1.add("Save");
- this.menu1.add("Save As...");
- this.menu1.addSeparator();
- this.menu1.add("Exit");
- this.mainMenuBar.add(this.menu1);
- this.menu2 = new Menu("Edit");
- this.menu2.add("Cut");
- this.menu2.add("Copy");
- this.menu2.add("Paste");
- this.mainMenuBar.add(this.menu2);
- this.menu3 = new Menu("Help");
- this.menu3.add("About");
- this.mainMenuBar.add(this.menu3);
- ((Frame)this).setMenuBar(this.mainMenuBar);
- }
-
- public Frame1(String title) {
- this();
- ((Frame)this).setTitle(title);
- }
-
- public synchronized void show() {
- ((Component)this).move(50, 50);
- super.show();
- this.field_0.addElement(new Thing("A Wotsit", "An ordinary Thing"));
- this.field_0.addElement(new Creature("A Troll", "A nasty fellow", "Trollus trollidus"));
- this.field_0.addElement(new Treasure("A Sword", "A jewel-encrusted weapon", 550));
- }
-
- public boolean handleEvent(Event event) {
- if (event.id == 201) {
- ((Component)this).hide();
- ((Frame)this).dispose();
- System.exit(0);
- return true;
- } else {
- if (event.target == this.button1 && event.id == 1001) {
- this.button1_Clicked(event);
- }
-
- return super.handleEvent(event);
- }
- }
-
- public boolean action(Event event, Object arg) {
- if (event.target instanceof MenuItem) {
- String label = (String)arg;
- if (label.equalsIgnoreCase("Open...")) {
- this.Open_Action(event);
- return true;
- }
-
- if (label.equalsIgnoreCase("About")) {
- this.About_Action(event);
- return true;
- }
-
- if (label.equalsIgnoreCase("Exit")) {
- this.Exit_Action(event);
- return true;
- }
- }
-
- return super.action(event, arg);
- }
-
- public static void main(String[] args) {
- (new Frame1()).show();
- }
- }
-